package org.hoyi.hrpc;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * 
 * HOYI RPC 方法.
 * 
 * @author ellen
 * 
 *
 */
public class HRPC {
	
	/**
	 * 创建新实例.
	 * @return vaue
	 */
	public static HRPC NEWI() {
		return new HRPC();
	}
	
	/**
	 * 创建RPC类.
	 * @param api
	 * @param urlName
	 * @return vaue
	 */
	public Object create(Class<?> api, String urlName) {
		if (api == null) {
			throw new NullPointerException("api must not be null for HRPC.create();");
		}
		
		InvocationHandler handler = null;
		return Proxy.newProxyInstance(api.getClassLoader(), new Class[] {api, Object.class}, handler);
	}
	
	
}
